<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>短信记录</title>
<link rel="stylesheet" type="text/css"
	href="/bsc/static/common/bootstrap/css/bootstrap.min.css" />
<script src="/bsc/static/js/jquery-3.1.1.js" type="text/javascript"
	charset="utf-8"></script>
<script
	src="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/js/bootstrap.min.js"
	type="text/javascript" charset="utf-8"></script>
<script
	src="/bsc/static/common/bootstrap/js/bootstarp-table-1.11.1/bootstrap-table.min.js"
	type="text/javascript" charset="utf-8"></script>
<script
	src="/bsc/static/common/bootstrap/js/bootstarp-table-1.11.1/bootstrap-table-zh-CN.min.js"
	type="text/javascript" charset="utf-8"></script> 

   <!-- <link rel="stylesheet" type="text/css"
	href="../static/common/layui/css/layui.css" media="all">   -->
	
<link rel="stylesheet" type="text/css"
	href="../static/common/global.css" media="all">
 <link rel="stylesheet" type="text/css" href="../static/css/personal.css"
	media="all"> 
<script type="text/javascript">

$(document).ready(function() {
    /*全选与反选按钮*/
    $("#all").click(function() {
        var state = $("#all").prop("checked");
        if(state == true) {
            $("[name='option']").prop("checked", "checked");
        } else {
            $("[name='option']").prop("checked", "");
        }
    });
    /*------------------------------------------------------------------------------------*/
    /*根据复选框是否全部选中来判断全选框是否选中*/
    //获取当前页面数据条数
    var options = $("[name='option']");
    //给每一个复选框加上click事件
    $("input[name='option']").click(function() {
        //获取当前选中的复选框个数
        var i = $("input[name='option']:checked");
        //判断复选框选中个数是否等于当前页面数据条数
        if(i.length == options.length) { //如果两者值相等那么全选按钮也会选中
            $("#all").prop("checked", "checked");
        } else { //当两者值不相等时全选框便不会显示选中
            $("#all").prop("checked", "");
        }
    });
    $(document).ready(function() {
				$("#btn").click(function() {//绑定
					/* alert("ghvvv"); */
					formName.action = "/bsc/bissms/toadd";//跳转
					formName.submit();

				});
				//删除全选和单选
				$("#delBtn").click(function(obj) {//绑定
									var array = "";
									var num = document.getElementsByName("option");
									for (var i = 0; i < num.length; i++) {
										if (num[i].checked) {
											array += num[i].value + ",";
										}
									}
									if (array.length > 0) {
										array = array.substring(0,array.length - 1);
										document.forms[0].action = "/bsc/bissms/delete?ids="+ array;
										document.forms[0].submit();
									} else {
										alert("请选择需要删除的数据");
									}
								});
				
				$("btn2").click(function(){
					formName.action="/bsc/bissms/list";
					formName.submit();
				})
			});
});
</script>
</head>
<body>
	<section class="layui-larry-box">
	<blockquote class="layui-elem-quote news_search">
		<form class="form-inline" role="form" id="formName" method="post">
			<table>
				<tr>
					<td>
						<div class="form-group">
							&nbsp;&nbsp;&nbsp;&nbsp;收件人：<input type="text"
								style="width: 160px; height: 33px" class="form-control"
								name="mobile" placeholder="请输入收件人" value="" id="">
						</div>
					</td>
					<td>
						<div class="form-group">
							短信内容：<input type="text"
								style="width: 160px; height: 33px" class="form-control"
								name="content" placeholder="请输入内容" value="" id="">
						</div>
					</td>
					<td>
						<div class="form-group">
							创建时间：<input type="date"
								style="width: 160px; height: 33px" class="form-control"
								name="create_time1" placeholder="" value="" id="">
						</div>
					</td>
					<td>
						<div class="form-group">
							至：<input type="date"
								style="width: 160px; height: 33px" class="form-control"
								name="create_time2" placeholder="" value="" id="">
						</div>
					</td>
					<td rowspan="2">
						&nbsp;
						<button type="butten" class="btn btn-info glyphicon glyphicon-search" id="btn2" value="查询">查询</button> 
						<button type="reset" class="btn btn-danger glyphicon glyphicon-refresh " value="重置">重置</button><br>
					</td>
				</tr>
				<tr>
					<td>
						<div class="form-group">
							       短信类型 ：<select class="form-control"
								style="min-width: 160px; height: 33px;" name="sms_type">
								<!--  <option value="-1">请选择</option>  -->
								<option value="1">普通验证</option>
								<!-- <option value="2">短信验证</option>
								<option value="3">支付验证</option> -->
							</select>
						</div>
					</td>
					<td>
						<div class="form-group">
							       发送状态：<select class="form-control"
								style="min-width: 160px; height: 33px;" name="status">
								 <option value="-1">请选择</option>
								<option value="1">成功</option>
								<option value="0">失败</option>
							</select>
						</div>
					</td>
					<td>
						<div class="form-group">
							发送时间：<input type="date"
								style="width: 160px; height: 33px;" class="form-control"
								name="send_time1" placeholder="" value="" id="">
						</div>
					</td>
					<td>
						<div class="form-group">
							至：<input type="date"
								style="width: 160px; height: 33px;" class="form-control"
								name="send_time2" placeholder="" value="" id="">
						</div>
					</td>
				</tr>
			</table>
	</blockquote>
	<div class="layui-form news_list">
		<table class="table table-hover table-bordered" border="1">
			<colgroup>
				<col width="5%">
				<col width="12%">
				<col width="10%">
				<col width="8%">
				<col width="12%">
				<col width="12%">
				<col width="10%">
				<col width="20%">
			</colgroup>
			<thead>
			 <tr class="active">
					<td colspan="8">
						<!-- <div class="form-group"> -->
						<input type="button" value="发送短信" id="btn" class="btn btn-info"  style="height: 35px;" />
						<input type="button" value="删除" id="delBtn"
						class="btn btn-danger" style="height: 35px;" />
						<!-- </div> -->
					</td>
				</tr>
				<tr class="active">
					<td class="text-center"><input type="checkbox" id="all">全选</td>
					<td class="text-center">收件人</td>
					<td class="text-center">短信内容</td>
					<td class="text-center">短信类行</td>
					<td class="text-center">创建时间</td>
					<td class="text-center">发送时间</td>
					<td class="text-center">发送状态</td>
					<td class="text-center">失败原因</td>
				</tr>
			</thead>
			<tbody class="news_content">
				<c:forEach items="${info.list}" var="sms">
					<tr> 
						<td class="text-center"><input type="checkbox" name="option"
							value="${sms.record_id}"></td>
						<td class="text-center">${sms.mobile}</td>
						<td class="text-center">${sms.content }</td>
						<td class="text-center"><c:if test="${sms.sms_type=='1' }">
						普通验证
						</c:if> <c:if test="${sms.sms_type=='2' }">
						短信验证
						</c:if> <c:if test="${sms.sms_type=='3' }">
						支付验证
						</c:if></td>
						<td class="text-center"><fmt:formatDate
								value="${sms.create_time }" pattern="yyyy-MM-dd hh:mm:ss" /></td>
						<td class="text-center"><fmt:formatDate
								value="${sms.send_time }" pattern="yyyy-MM-dd hh:mm:ss" /></td>
						<td class="text-center"><c:if test="${sms.status=='1' }">
						成功
						</c:if> <c:if test="${sms.status=='0' }">
						失败
						</c:if></td>
						<td class="text-center">${sms.failure_cause}</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</div>
	<div class="">
  <a href="#" class="btn btn-link glyphicon glyphicon-backward" onclick="up()">上一页</a>   <a class="btn btn-link glyphicon glyphicon-forward" href="#" onclick="next()" >下一页</a>
</div> 
	</form>
	</section>
<script type="text/javascript">
	//上一页
function up(){
	document.forms[0].action="/bsc/bissms/list?page="+${info.prePage};
	document.forms[0].submit();
};
//下一页
function next(){
	document.forms[0].action="/bsc/bissms/list?page="+${info.nextPage};
	document.forms[0].submit();
};
</script>
</body>
</html>